﻿
#region Copyright & License
// --------------------------
// Copyright 2008 Daniel Gray
// --------------------------
// This file is part of Kale.
//
// Kale is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Kale is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with Kale.  If not, see <http://www.gnu.org/licenses/>.
#endregion
#region File details
// --------------------------------------------------------
// Filename          : ISecurityPrincipal.cs
// Author            : Daniel Gray
// Created           : 28/04/2008
// --------------------------------------------------------
#endregion
            
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kale.Core.Security
{
   public interface ISecurityProvider : ICachingProvider
   {
      /// <summary>
      /// Gets the user with the specified username.
      /// </summary>
      /// <param name="userName">The username of the user to retrieve.</param>
      /// <returns>An instance of <see cref="IUser"/> if the user exists, otherwise <b>null</b>.</returns>
      IUser GetUser(string userName);
      /// <summary>
      /// Gets the user with the specified Uid.
      /// </summary>
      /// <param name="userUid">The Uid of the user to retrieve.</param>
      /// <returns>An instance of <see cref="IUser"/> if the user exists, otherwise <b>null</b>.</returns>
      IUser GetUser(Guid userUid);

      /// <summary>
      /// Gets the user group with the specified name.
      /// </summary>
      /// <param name="userGroupName">The name of the group to retrieve.</param>
      /// <returns>An instance of <see cref="IUserGroup"/> if the group exists, otherwise <b>null</b>.</returns>
      IUserGroup GetUserGroup(string userGroupName);
      /// <summary>
      /// Gets the user group with the specified Uid.
      /// </summary>
      /// <param name="userGroupUid">The Uid of the user group to retrieve.</param>
      /// <returns>An instance of <see cref="IUserGroup"/> if the group exists, otherwise <b>null</b>.</returns>
      IUserGroup GetUserGroup(Guid userGroupUid);

      /// <summary>
      /// Gets the user role with the specified name.
      /// </summary>
      /// <param name="userRoleName">The name of the role to retrieve.</param>
      /// <returns>An instance of <see cref="IUserRole"/> if the role exists, otherwise <b>null</b>.</returns>
      IUserRole GetUserRole(string userRoleName);
      /// <summary>
      /// Gets the user role with the specified Uid.
      /// </summary>
      /// <param name="userRoleUid">The Uid of the role to retrieve.</param>
      /// <returns>An instance of <see cref="IUserRole"/> if the role exists, otherwise <b>null</b>.</returns>
      IUserRole GetUserRole(Guid userRoleUid);

      /// <summary>
      /// Gets all the user groups the specified user explicitly belongs to.
      /// </summary>
      /// <param name="userUid">The Uid of the user.</param>
      /// <returns>An array of <see cref="IUserGroup"/>.</returns>
      IUserGroup[] GetUserGroupsForUser(Guid userUid);
      /// <summary>
      /// Gets all the user roles the specified user explicitly has.
      /// </summary>
      /// <param name="userUid">The Uid of the user.</param>
      /// <returns>An array of <see cref="IUserRole"/>.</returns>
      IUserRole[] GetUserRolesForUser(Guid userUid);

      /// <summary>
      /// Gets all the user groups the specified user group explicitly belongs to.
      /// </summary>
      /// <param name="userGroupUid">The Uid of the user group.</param>
      /// <returns>An array of <see cref="IUserGroup"/>.</returns>
      IUserGroup[] GetUserGroupsForUserGroup(Guid userGroupUid);
      /// <summary>
      /// Gets all the roles the specified user group explicitly has.
      /// </summary>
      /// <param name="userGroupUid"></param>
      /// <returns></returns>
      IUserRole[] GetUserRolesForUserGroup(Guid userGroupUid);

      /// <summary>
      /// Gets all the user groups.
      /// </summary>
      /// <returns>An array of <see cref="IUserGroup"/>.</returns>
      IUserGroup[] GetUserGroups();
      /// <summary>
      /// Gets all the user roles.
      /// </summary>
      /// <returns>An array of <see cref="IUserRole"/>.</returns>
      IUserRole[] GetUserRoles();
      /// <summary>
      /// Gets all the users.
      /// </summary>
      /// <returns>An array of <see cref="IUser"/>.</returns>
      IUser[] GetUsers();
   }
}
